
#include <QAudioInput>
#include <QAudioOutput>
#include <QCoreApplication>

int main(int argc, char *argv[])
{
	QCoreApplication a(argc, argv);

	QAudioFormat format;
	format.setSampleRate(44100);
	format.setChannelCount(1);
	format.setSampleSize(16);
	format.setCodec("audio/pcm");
	format.setByteOrder(QAudioFormat::LittleEndian);
	format.setSampleType(QAudioFormat::SignedInt);
	QAudioInput ai(format, &a);
	QAudioOutput ao(format, &a);
	QIODevice *inputDevice = ai.start();
	QIODevice *outputDevice = ao.start();

	bool b = QObject::connect(inputDevice, &QIODevice::readyRead, [=]()
	{
        QByteArray audioData = inputDevice->readAll();
        outputDevice->write(audioData);
	});

	return a.exec();
}
